package cn.hnkjxy.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hnkjxy.dao.ProductDao;
import cn.hnkjxy.po.Product;
import cn.hnkjxy.service.ProductService;

@Service
@Transactional
public class ProductServiceImpl implements ProductService {
	@Autowired
	private ProductDao productDao;

	public List<Product> findAllProduct() {
		return this.productDao.findAllProduct();
	}

	@Override
	public Product findProductById(Integer prid) {
		Product product = this.productDao.findProductById(prid);
		return product;
	}

	@Override
	public Integer modifyproductstatus(Integer prid, Integer state) {
		Integer row = this.productDao.modifyproductstatus(prid, state);
		return row;
	}

	@Override
	public Integer deleteProduct(Integer prid) {
		Integer row = this.productDao.deleteProduct(prid);
		return row;
	}

	@Override
	public Integer modifyproductstatus2(Product product) {
		Integer row = this.productDao.modifyproductstatus2(product);
		return row;
	}

	@Override
	public List<Product> findProductByCondition(Product product) {
		List<Product> products = this.productDao.findProductByCondition(product);
		return products;
	}

	@Override
	public List<Double> findAllPrice() {
		List<Double> prices = this.productDao.findAllPrice();
		return prices;
	}

	@Override
	public Integer addProduct(Product product) {
		Integer row = this.productDao.addProduct(product);
		return row;
	}

	@Override
	public Integer verificationProduct(String roomnumber) {
		Integer prid = this.productDao.verificationProduct(roomnumber);
		return prid;
	}

}
